|
|
|
|
|
|
|
The preceding code first tells Visual Basic to ignore any reported errors, and then it supplies a set of parameters for creating an ODBC data source. The parameters for the RegisterDatabase method are |
|
|
|
|
|
|
|
|
·SourceName: The name that will be used as the database name for the OpenDatabase method. |
|
|
|
|
|
|
|
|
·DriverName: The name of an ODBC driver installed and available on your work- station. |
|
|
|
|
|
|
|
|
·SilentFlag: Setting this to False forces Windows to present the ODBC registration dialog box. If it is set to True, Windows attempts to register the ODBC data source without prompting the user with the ODBC registration dialog box. |
|
|
|
|
|
|
|
|
·AttributeList: A list of attribute settings for the ODBC source. Examples of attributes include any server device name, database name, and any other parameters required by the back-end database server. |
|
|
|
|
| |
|
|
|
|
The Microsoft Visual Basic documentation tells you to create an Attributes list with each attribute separated by a CR-LF pair. This is not correct. You should delimit each attribute entry with a CHR(0) in order for the RegisterDatabase routine to work properly. |
|
|
|
|
|
|
|
|
|
|
Save and run the project. When you click the DBRegister button, you see the Windows ODBC Registration dialog box appear with some of the parameters already entered. You can complete the information and click OK to register the ODBC data source on your system. Refer to Figure 9.4 as an example. |
|
|
|
|
|
|
|
|
Figure 9.4.
Registering an ODBC data source. |
|
|
|
|
|